"""
WSGI config for elastic_search project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "elastic_search.settings")

print("autoload------------------------")
print("autoload------------------------")
application = get_wsgi_application()
'''

This will import a {{{startup.py}}} file located in your project's package. The
only requirement is that you define the {{{run}}} method.In Pinax we decided to
take it a little bit further. Since registering signals is a common task to do
we wrote a utility function we put in our {{{startup.py}}}:

'''
# from django.conf import settings
# from django.utils.importlib import import_module
# from django.utils.module_loading import module_has_submodule


def autoload(submodules):
    print("autoload------------------------")
    print("autoload------------------------")
    # for app in settings.INSTALLED_APPS:
    #     mod = import_module(app)
    #     for submodule in submodules:
    #         try:
    #             import_module("{}.{}".format(app, submodule))
    #         except:
    #             if module_has_submodule(mod, submodule):
    #                 raise


def run():
    autoload(["receivers"])
